<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">
<ui:define name="head">
    <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
    <script type="text/javascript" language="javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
                else
                    event.srcElement.click();
            }
        }
        function actSelect(obj) {
            var pkid = document.getElementById("form:hiPkid").value;
            if (obj == "Subctt") {
                var sfeature = "dialogwidth:1300px;dialogheight:700px;center:yes;location:no;help:no;resizable:no;scroll:yes;status:no";
                var arg = new Object();
                arg.doType = "select";
                // 分包合同
                var rtn = dialog("../item/itemHieRelapQry_Cstpl_Sub.xhtml?strType=2&amp;strSubCttPkid=" + pkid, arg, sfeature);
            }
            else if (obj == "SubcttAttachment") {
                var rtn = window.open("/epss/servlet/ShowServlet?operType=Qry&amp;strType=0&amp;strPkid=" + pkid + "",
                        'popupwindow',
                        'height = 300,width = 450,location = no,resizable = no,scrollbars = yes,status = no,toolbar = no,top = 100');
            }
        }
    </script>
    <style type="text/css">
        .c_c {
            background: gray;
        }

        .p_c {
            background: green;
        }
    </style>
</ui:define>
<ui:define name="content">
    <div style="margin:5px;">
        <h:form id="form">
            <p:growl id="msgs" showDetail="false"/>
            <h:inputHidden id="hiPkid"
                           value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSubcttPkid}"></h:inputHidden>
            <p:ajaxStatus style="width:16px;height:16px;">
                <f:facet name="start">
                    <h:graphicImage value="/images/ajaxloading.gif"/>
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value=""/>
                </f:facet>
            </p:ajaxStatus>
            <p:panel header="分包合同工程价格结算" style="width: 100%">
                <p:dataTable id="pdt" style="heiht:100%;width:100%;"
                             value="#{itemHieRelapStlEngPAction.itemStlSubcttEngPMngList}"
                             var="record"
                             rowKey="#{record.subctt_Pkid}"
                             selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
                                            {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="100"
                             rowsPerPageTemplate="200,100,50,40,30,20,10"
                             rowIndexVar="row"
                             emptyMessage="数据记录为空..."
                             widgetVar="dtItemDetail"
                             rowStyleClass="#{record.subctt_Name eq '小计'? 'c_c':
                                                 record.subctt_Name eq '本期净结算额'? 'p_c':
                                                 record.subctt_Name eq '合计(扣除其它栏款项后本期结算价值)'?'p_c':
                                                 record.subctt_Name eq '其中:安全施工措施费'?'c_c':
                                                 record.subctt_Name eq '质保金'? 'p_c':null}"
                             stickyHeader="#{itemHieRelapStlEngPAction.strStickyHeaderFlag}">
                    <f:facet name="header">
                        <div style="text-align: right">
                            <p:outputLabel value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strDate}"/>
                        </div>
                    </f:facet>

                    <p:columnGroup type="header">
                        <p:row>
                            <p:column headerText="工程名称"/>
                            <p:column colspan="4"
                                      headerText="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strTkcttName}"
                                      style="text-align: left"/>
                            <p:column headerText="结算单编号"/>
                            <p:column colspan="6"
                                      headerText="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strStlId}"
                                      style="text-align: left"/>
                        </p:row>

                        <p:row>
                            <p:column headerText="工程项目"/>
                            <p:column colspan="4"
                                      headerText="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSubcttName}"
                                      style="text-align: left"/>
                            <p:column headerText="协作合同编号"/>
                            <p:column colspan="6"
                                      headerText="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSubcttId}"
                                      style="text-align: left"/>
                        </p:row>

                        <p:row>
                            <p:column headerText="协作队伍"/>
                            <p:column colspan="11"
                                      headerText="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSignPartName}"
                                      style="text-align: left"/>
                        </p:row>

                        <p:row>
                            <p:column rowspan="2" headerText="序号"/>
                            <p:column rowspan="2" headerText="编号"/>
                            <p:column rowspan="2" headerText="分项项目名称"/>
                            <p:column rowspan="2" headerText="单位"/>
                            <p:column rowspan="2" headerText="合同单价"/>
                            <p:column rowspan="2" headerText="合同数量"/>
                            <p:column rowspan="2" headerText="合同金额"/>
                            <p:column colspan="2" headerText="本期"/>
                            <p:column colspan="2" headerText="开累"/>
                            <p:column rowspan="2" headerText="备注内容"/>
                        </p:row>
                        <p:row>
                            <p:column headerText="数量"/>
                            <p:column headerText="金额"/>
                            <p:column headerText="数量"/>
                            <p:column headerText="金额"/>
                        </p:row>
                    </p:columnGroup>

                    <p:column>
                        <h:outputText value="#{row + 1}"/>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_StrNo}" escape="false"/>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_Name}"/>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_Unit}" style="text-align:right"/>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_ContractUnitPrice}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_ContractQuantity}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_ContractAmount}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.engPMng_CurrentPeriodEQty}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.engPMng_CurrentPeriodAmt}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.engPMng_BeginToCurrentPeriodEQty}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.engPMng_BeginToCurrentPeriodAmt}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column>
                        <h:outputText value="#{record.subctt_Note}"/>
                    </p:column>

                    <f:facet name="footer">
                        <div style="text-align: left">
                            <p:commandButton value="导出到EXCEL"
                                             action="#{itemHieRelapStlEngPAction.onExportExcel}"
                                             ajax="false"
                                             rendered="#{itemHieRelapStlEngPAction.strExportToExcelRendered}">
                            </p:commandButton>
                            <p:commandButton value="分包合同"
                                             oncomplete="actSelect('Subctt')"
                                             rendered="false">
                            </p:commandButton>
                            <p:commandButton value="分包合同附件"
                                             oncomplete="actSelect('SubcttAttachment')"
                                             rendered="#{itemHieRelapStlEngPAction.strExportToExcelRendered}">
                            </p:commandButton>
                        </div>
                    </f:facet>
                </p:dataTable>
            </p:panel>
        </h:form>
    </div>
</ui:define>
</ui:composition>